package PhotoVoltaic.Equipment;

import java.io.Serializable;

//设备管理器基类
public class BaseEquip implements Serializable{
	//define the type of the Equipment
	String type;

	//Define the attributions of the class
	protected String name;
	protected static int Num = 0;
	protected String ID;
	protected Status status;
	
	//explicit construct function
	BaseEquip() {
		Num++;
	}
	
	//construct function
	BaseEquip(String name, String status) {
		this.name = name;
		if("正常".equals(status)) {
			this.status = Status.Normal;
		} else if ("故障".equals(status)) {
			this.status = Status.Broken;
		} else if ("停机".equals(status)) {
			this.status = Status.Stop;
		}
		this.ID = String.format("E%04d",Num++);
	}
	//return the name,combiner or inverter
	public String getname() {
		return this.name;
	}
	//return the ID
	public String getID() {
		return this.ID;
	}
	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}


	public void setID(String ID) {
		this.ID = ID;
	}

	public String getStatus() {
		if( this.status == Status.Normal ) {
			return "正常";
		} else if (this.status == Status.Broken ) {
			return "故障";
		} else if (this.status == Status.Stop ) {
			return "停机";
		}
		return null;
	}

	public void setStatus(Status status) {
		this.status = status;
	}
}
